/**
 * Copyright 2011 Joe Choi, All rights reserved.
 */
package tec.code.han.ts;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import tec.code.FileUtil;
import tec.code.han.CodeUtil;

/**
 * To create Traditional and Simplified Chinese conversion table
 * 
 * @author Joe Choi
 */
class TSConversionTable {
	public static void main(String[] args) throws IOException {
		String dest = "cfg/ts.tab";
		create(dest);
		System.out.println("Conversion Table has created to file: " + dest);
	}
	
	public static List<Character> load() throws IOException {
		return(FileUtil.loadChar("cfg/ts.tab", "UTF-8"));
	}
	
	public static void create(String file) throws IOException {
		List<Character> traditional = CodeUtil.loadTraditional();
		List<Character> simplified = CodeUtil.loadSimplified();
		List<Character> ts = new ArrayList<Character>();
		for (int i = 0; i < traditional.size(); i++) {
			ts.add(traditional.get(i));
			ts.add(simplified.get(i));
		}
		FileUtil.save(ts, file, "UTF-8");
	}	
}